from datetime import datetime, timedelta

# 获取当前时间
current_time = datetime.now()
formatted_time = current_time.strftime("%Y-%m-%d")
print(formatted_time)

# 时间加减
current_time += timedelta(days=-1)
formatted_time = current_time.strftime("%Y-%m-%d")
print(formatted_time)


yesterday_time = timedelta(days=-1) + datetime.now()
yesterday_date = yesterday_time.strftime("%Y-%m-%d")
print(yesterday_date)


start_date = end_date = yesterday_time.strftime(yesterday_date)
print(start_date)
print(end_date)